<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/page/inc/taglib.jsp"%>
<div class="pageContent">
	<form method="post" action="${pageContext.request.contextPath}${requestScope.record ==null ?'/warehouse/wareInventoryOrder/insert' :'/warehouse/wareInventoryOrder/update' }" class="pageForm required-validate" onsubmit="return validateCallback(this, dialogAjaxDone);">
		<div class="pageFormContent" layoutH="56">
			<!-- 关闭窗口 -->
			<input type="hidden" name="callbackType" value="closeCurrent" />
			<!-- 隐藏表单 -->

			<c:if test="${requestScope.record !=null}">

				<input type="hidden" name="id" value="${requestScope.record.id}" />

			</c:if>

			<p>
				<label>订单编号</label> <input name="onum" class="required" maxlength="50" type="text" value="${requestScope.record.onum}" />
			</p>
			<p>
				<label>备注</label> <input name="remk" class="required" maxlength="500" type="text" value="${requestScope.record.remk}" />
			</p>
			<table class="table" targetType="navTab" asc="asc" desc="desc" width="100%" layoutH="138">
				<thead>
					<tr>
						<th>商品编号</th>
						<th>商品名称</th>
						<th>仓库名称</th>
						<th>系统库存</th>
						<th>盘点库存</th>
						<th>盘盈盘亏</th>
					</tr>
				</thead>
				<tbody>

					<c:if test="${requestScope.dwzPageBean != null &&  requestScope.dwzPageBean.recordList != null }">
						<c:forEach var="record" items="${requestScope.dwzPageBean.recordList}" varStatus="status">
							<tr>
								<td>${record.pnnum}</td>
								<td>${record.pnname}</td>
								<td>${record.whname}</td>
								<td>${record.wiamut}</td>
								<td><input name="itat" class="digits" type="text" value="${record.itat}" onchange="changeItat(this)" /></td>
								<td>
									<input name="psat" class="" type="hidden" value="${record.psat}" />
									<p>${record.psat}</p>
									<input name="wiid" type="hidden" value="${record.wiid}" />
								</td>
							</tr>
						</c:forEach>
					</c:if>

				</tbody>
			</table>

		</div>
		<div class="formBar">
			<ul>
				<!--<li><a class="buttonActive" href="javascript:;"><span>保存</span></a></li>-->
				<li><div class="buttonActive">
						<div class="buttonContent">
							<button type="submit">保存</button>
						</div>
					</div></li>
				<li>
					<div class="button">
						<div class="buttonContent">
							<button type="button" class="close">取消</button>
						</div>
					</div>
				</li>
			</ul>
		</div>
	</form>
</div>
<script type="text/javascript">
	function changeItat(obj) {
		var itat = $(obj).val();
		var wiamut = $(obj).parent().parent().prev().children().html();
		$(obj).parent().parent().next().children().children("[name='psat']").val(itat-wiamut);
		$(obj).parent().parent().next().children().children("p").html(itat-wiamut);
	}
</script>